import java.lang.reflect.Array;
import java.util.Arrays;

public class Text3 {
    public static void main(String[] args) {
        int[][] arr1={{0,0,19,0,0},{0,0,87,0,0},{77,0,0,0,0},{0,0,0,0,0},{5,29,0,26,0}};
        int[][] arr2=new int[7][3];
        int a=1;
        int b=0;
        int c=0;
        for (int i=0;i<arr1.length;i++){
            for (int j=0;j<arr1[0].length;j++){
                if (arr1[i][j]!=0){
                    arr2[a]= new int[]{i, j, arr1[i][j]};
                    a++;
                    c++;
                }
            }
        }
        arr2[0]= new int[]{arr1.length, arr1[0].length, c};


        for (int i=0;i<arr2.length;i++){
            System.out.println(Arrays.toString(arr2[i]));
        }

        int[][] arr3=new int[arr2[0][0]][arr2[0][1]];
        for (int i=0;i<arr3.length;i++){
            for (int j=0;j<arr3.length;j++){
                arr3[i][j]=0;
            }
        }
        for (int i=0;i<arr2[0][2];i++){
//            arr3[]
        }
    }
}
